package com.sdwl.brcl.validation.validation;

import java.util.Collection;
import java.util.Iterator;

/**
 * @author xied
 * @date 2021年06月11日 14:16
 */
public class CollectionEachNotNullValidator implements Validator {
    public CollectionEachNotNullValidator() {
    }

    @Override
    public boolean validate(Object value) {
        if (value == null) {
            return false;
        } else {
            Collection<?> collection = (Collection)value;
            Iterator var3 = collection.iterator();

            Object obj;
            do {
                if (!var3.hasNext()) {
                    return true;
                }

                obj = var3.next();
            } while(obj != null);

            return false;
        }
    }

    @Override
    public String validateCode() {
        return "collection.each.not.null";
    }

    @Override
    public String validateMsg(Object value, String validateName) {
        return validateName + "中的每个元素都不能为空";
    }
}

